with t_scan as (
    select *
    from jms_dwd.dwd_s03_waybill_trace_scan_dt
    where dt = '{{ execution_date | cst_ds }}'
      and waybill_end_scantype in ('sign', 'outStore'))
   , t_unsign as (
    select *
    from jms_dwd.dwd_s03_waybill_trace_unsigned_dt
    where dt = date_add('{{ execution_date | cst_ds }}', -1))
insert overwrite table jms_dwd.dwd_s03_waybill_trace_unsigned_dt partition ( dt )
select waybill_no,
       waybill_first_scantime,
       waybill_first_scantype,
       waybill_end_scantime,
       waybill_end_scantype,
       waybill_all_operation_times,
       center_all_operation_times,
       nodal_all_operation_times,
       network_all_count,
       center_all_count,
       nodal_all_count,
       actual_taking_scantime,
       actual_taking_scansitecode,
       actual_taking_weight,
       actual_taking_scantype,
       taking_later_scantime,
       taking_early_scantime,
       taking_early_scansitecode,
       taking_early_weight,
       warehousing_later_scantime,
       warehousing_early_scantime,
       warehousing_early_scansitecode,
       warehousing_early_weight,
       bagging_early_scantime,
       bagging_early_scansitecode,
       bagging_early_package_code,
       first_network_network_code,
       first_network_loading_later_time,
       first_network_loading_later_weight,
       first_network_send_later_time,
       first_network_send_later_weight,
       first_network_loading_send_shipment_no,
       first_network_loading_send_planned_departure_time,
       first_network_loading_send_planned_arrival_time,
       first_network_loading_send_actual_departure_time,
       first_network_loading_send_actual_arrival_time,
       first_network_loading_send_next_network_code,
       first_network_loading_send_next_network_type,
       first_nodal_network_code,
       first_nodal_unloading_early_time,
       first_nodal_unloading_early_weight,
       first_nodal_arrival_early_time,
       first_nodal_arrival_early_weight,
       first_nodal_unloading_arrival_shipment_no,
       first_nodal_unloading_arrival_planned_departure_time,
       first_nodal_unloading_arrival_planned_arrival_time,
       first_nodal_unloading_arrival_actual_departure_time,
       first_nodal_unloading_arrival_actual_arrival_time,
       first_nodal_loading_later_time,
       first_nodal_loading_later_weight,
       first_nodal_send_later_time,
       first_nodal_send_later_weight,
       first_nodal_loading_send_shipment_no,
       first_nodal_loading_send_planned_departure_time,
       first_nodal_loading_send_planned_arrival_time,
       first_nodal_loading_send_actual_departure_time,
       first_nodal_loading_send_actual_arrival_time,
       first_nodal_loading_send_next_network_code,
       first_nodal_loading_send_next_network_type,
       first_center_network_code,
       first_center_unloading_early_time,
       first_center_unloading_early_weight,
       first_center_arrival_early_time,
       first_center_arrival_early_weight,
       first_center_unloading_arrival_shipment_no,
       first_center_unloading_arrival_planned_departure_time,
       first_center_unloading_arrival_planned_arrival_time,
       first_center_unloading_arrival_actual_departure_time,
       first_center_unloading_arrival_actual_arrival_time,
       first_center_loading_later_time,
       first_center_loading_later_weight,
       first_center_send_later_time,
       first_center_send_later_weight,
       first_center_loading_send_shipment_no,
       first_center_loading_send_planned_departure_time,
       first_center_loading_send_planned_arrival_time,
       first_center_loading_send_actual_departure_time,
       first_center_loading_send_actual_arrival_time,
       first_center_loading_send_next_network_code,
       first_center_loading_send_next_network_type,
       second_center_network_code,
       second_center_unloading_early_time,
       second_center_unloading_early_weight,
       second_center_arrival_early_time,
       second_center_arrival_early_weight,
       second_center_unloading_arrival_shipment_no,
       second_center_unloading_arrival_planned_departure_time,
       second_center_unloading_arrival_planned_arrival_time,
       second_center_unloading_arrival_actual_departure_time,
       second_center_unloading_arrival_actual_arrival_time,
       second_center_loading_later_time,
       second_center_loading_later_weight,
       second_center_send_later_time,
       second_center_send_later_weight,
       second_center_loading_send_shipment_no,
       second_center_loading_send_planned_departure_time,
       second_center_loading_send_planned_arrival_time,
       second_center_loading_send_actual_departure_time,
       second_center_loading_send_actual_arrival_time,
       second_center_loading_send_next_network_code,
       second_center_loading_send_next_network_type,
       third_center_network_code,
       third_center_unloading_early_time,
       third_center_unloading_early_weight,
       thirdcenter_arrival_early_time,
       third_center_arrival_early_weight,
       third_center_unloading_arrival_shipment_no,
       third_center_unloading_arrival_planned_departure_time,
       third_center_unloading_arrival_planned_arrival_time,
       third_center_unloading_arrival_actual_departure_time,
       third_center_unloading_arrival_actual_arrival_time,
       third_center_loading_later_time,
       third_center_loading_later_weight,
       third_center_send_later_time,
       third_center_send_later_weight,
       third_center_loading_send_shipment_no,
       third_center_loading_send_planned_departure_time,
       third_center_loading_send_planned_arrival_time,
       third_center_loading_send_actual_departure_time,
       third_center_loading_send_actual_arrival_time,
       third_center_loading_send_next_network_code,
       third_center_loading_send_next_network_type,
       fourth_center_network_code,
       fourth_center_unloading_early_time,
       fourth_center_unloading_early_weight,
       fourth_center_arrival_early_time,
       fourth_center_arrival_early_weight,
       fourth_center_unloading_arrival_shipment_no,
       fourth_center_unloading_arrival_planned_departure_time,
       fourth_center_unloading_arrival_planned_arrival_time,
       fourth_center_unloading_arrival_actual_departure_time,
       fourth_center_unloading_arrival_actual_arrival_time,
       fourth_center_loading_later_time,
       fourth_center_loading_later_weight,
       fourth_center_send_later_time,
       fourth_center_send_later_weight,
       fourth_center_loading_send_shipment_no,
       fourth_center_loading_send_planned_departure_time,
       fourth_center_loading_send_planned_arrival_time,
       fourth_center_loading_send_actual_departure_time,
       fourth_center_loading_send_actual_arrival_time,
       fourth_center_loading_send_next_network_code,
       fourth_center_loading_send_next_network_type,
       end_center_network_code,
       end_center_unloading_early_time,
       end_center_unloading_early_weight,
       end_center_arrival_early_time,
       end_center_arrival_early_weight,
       end_center_unloading_arrival_shipment_no,
       end_center_unloading_arrival_planned_departure_time,
       end_center_unloading_arrival_planned_arrival_time,
       end_center_unloading_arrival_actual_departure_time,
       end_center_unloading_arrival_actual_arrival_time,
       end_center_loading_later_time,
       end_center_loading_later_weight,
       end_center_send_later_time,
       end_center_send_later_weight,
       end_center_loading_send_shipment_no,
       end_center_loading_send_planned_departure_time,
       end_center_loading_send_planned_arrival_time,
       end_center_loading_send_actual_departure_time,
       end_center_loading_send_actual_arrival_time,
       end_center_loading_send_next_network_code,
       end_center_loading_send_next_network_type,
       end_nodal_network_code,
       end_nodal_unloading_early_time,
       end_nodal_unloading_early_weight,
       end_nodal_arrival_early_time,
       end_nodal_arrival_early_weight,
       end_nodal_unloading_arrival_shipment_no,
       end_nodal_unloading_arrival_planned_departure_time,
       end_nodal_unloading_arrival_planned_arrival_time,
       end_nodal_unloading_arrival_actual_departure_time,
       end_nodal_unloading_arrival_actual_arrival_time,
       end_nodal_loading_later_time,
       end_nodal_loading_later_weight,
       end_nodal_send_later_time,
       end_nodal_send_later_weight,
       end_nodal_loading_send_shipment_no,
       end_nodal_loading_send_planned_departure_time,
       end_nodal_loading_send_planned_arrival_time,
       end_nodal_loading_send_actual_departure_time,
       end_nodal_loading_send_actual_arrival_time,
       end_nodal_loading_send_next_network_code,
       end_nodal_loading_send_next_network_type,
       end_network_network_code,
       end_network_unloading_early_time,
       end_network_arrival_early_time,
       deliver_early_scantime,
       deliver_later_scantime,
       deliver_later_scansitecode,
       deliver_later_weight,
       deliver_later_user,
       sign_later_scantime,
       sign_early_scantime,
       sign_early_scansitecode,
       sign_early_weight,
       aging_sign_scantime,
       aging_sign_scansitecode,
       aging_sign_weight,
       aging_sign_scantype,
       actual_sign_scantime,
       actual_sign_scansitecode,
       actual_sign_weight,
       actual_sign_scantype,
       waybill_status_code,
       goods_type_id,
       goods_type_code,
       goods_type_name,
       goods_name,
       dispatch_network_code,
       first_code,
       second_code,
       third_code,
       is_sign,
       sign_time,
       is_abnormal,
       waybill_source_code,
       waybill_source_name,
       is_void,
       is_refund,
       pick_network_code,
       pick_network_name,
       input_time,
       input_network_code,
       settlement_weight,
       order_source_code,
       is_delete,
       package_collect_weight,
       package_receipt_weight,
       waybill_weight,
       center_name,
       center_code,
       ordersource_code,
       ordersource_name,
       dt
from (
         select *, row_number() over (partition by waybill_no order by waybill_end_scantime desc) rnk
         from (
                  select waybill_no,
                         waybill_first_scantime,
                         waybill_first_scantype,
                         waybill_end_scantime,
                         waybill_end_scantype,
                         waybill_all_operation_times,
                         center_all_operation_times,
                         nodal_all_operation_times,
                         network_all_count,
                         center_all_count,
                         nodal_all_count,
                         actual_taking_scantime,
                         actual_taking_scansitecode,
                         actual_taking_weight,
                         actual_taking_scantype,
                         taking_later_scantime,
                         taking_early_scantime,
                         taking_early_scansitecode,
                         taking_early_weight,
                         warehousing_later_scantime,
                         warehousing_early_scantime,
                         warehousing_early_scansitecode,
                         warehousing_early_weight,
                         bagging_early_scantime,
                         bagging_early_scansitecode,
                         bagging_early_package_code,
                         first_network_network_code,
                         first_network_loading_later_time,
                         first_network_loading_later_weight,
                         first_network_send_later_time,
                         first_network_send_later_weight,
                         first_network_loading_send_shipment_no,
                         first_network_loading_send_planned_departure_time,
                         first_network_loading_send_planned_arrival_time,
                         first_network_loading_send_actual_departure_time,
                         first_network_loading_send_actual_arrival_time,
                         first_network_loading_send_next_network_code,
                         first_network_loading_send_next_network_type,
                         first_nodal_network_code,
                         first_nodal_unloading_early_time,
                         first_nodal_unloading_early_weight,
                         first_nodal_arrival_early_time,
                         first_nodal_arrival_early_weight,
                         first_nodal_unloading_arrival_shipment_no,
                         first_nodal_unloading_arrival_planned_departure_time,
                         first_nodal_unloading_arrival_planned_arrival_time,
                         first_nodal_unloading_arrival_actual_departure_time,
                         first_nodal_unloading_arrival_actual_arrival_time,
                         first_nodal_loading_later_time,
                         first_nodal_loading_later_weight,
                         first_nodal_send_later_time,
                         first_nodal_send_later_weight,
                         first_nodal_loading_send_shipment_no,
                         first_nodal_loading_send_planned_departure_time,
                         first_nodal_loading_send_planned_arrival_time,
                         first_nodal_loading_send_actual_departure_time,
                         first_nodal_loading_send_actual_arrival_time,
                         first_nodal_loading_send_next_network_code,
                         first_nodal_loading_send_next_network_type,
                         first_center_network_code,
                         first_center_unloading_early_time,
                         first_center_unloading_early_weight,
                         first_center_arrival_early_time,
                         first_center_arrival_early_weight,
                         first_center_unloading_arrival_shipment_no,
                         first_center_unloading_arrival_planned_departure_time,
                         first_center_unloading_arrival_planned_arrival_time,
                         first_center_unloading_arrival_actual_departure_time,
                         first_center_unloading_arrival_actual_arrival_time,
                         first_center_loading_later_time,
                         first_center_loading_later_weight,
                         first_center_send_later_time,
                         first_center_send_later_weight,
                         first_center_loading_send_shipment_no,
                         first_center_loading_send_planned_departure_time,
                         first_center_loading_send_planned_arrival_time,
                         first_center_loading_send_actual_departure_time,
                         first_center_loading_send_actual_arrival_time,
                         first_center_loading_send_next_network_code,
                         first_center_loading_send_next_network_type,
                         second_center_network_code,
                         second_center_unloading_early_time,
                         second_center_unloading_early_weight,
                         second_center_arrival_early_time,
                         second_center_arrival_early_weight,
                         second_center_unloading_arrival_shipment_no,
                         second_center_unloading_arrival_planned_departure_time,
                         second_center_unloading_arrival_planned_arrival_time,
                         second_center_unloading_arrival_actual_departure_time,
                         second_center_unloading_arrival_actual_arrival_time,
                         second_center_loading_later_time,
                         second_center_loading_later_weight,
                         second_center_send_later_time,
                         second_center_send_later_weight,
                         second_center_loading_send_shipment_no,
                         second_center_loading_send_planned_departure_time,
                         second_center_loading_send_planned_arrival_time,
                         second_center_loading_send_actual_departure_time,
                         second_center_loading_send_actual_arrival_time,
                         second_center_loading_send_next_network_code,
                         second_center_loading_send_next_network_type,
                         third_center_network_code,
                         third_center_unloading_early_time,
                         third_center_unloading_early_weight,
                         thirdcenter_arrival_early_time,
                         third_center_arrival_early_weight,
                         third_center_unloading_arrival_shipment_no,
                         third_center_unloading_arrival_planned_departure_time,
                         third_center_unloading_arrival_planned_arrival_time,
                         third_center_unloading_arrival_actual_departure_time,
                         third_center_unloading_arrival_actual_arrival_time,
                         third_center_loading_later_time,
                         third_center_loading_later_weight,
                         third_center_send_later_time,
                         third_center_send_later_weight,
                         third_center_loading_send_shipment_no,
                         third_center_loading_send_planned_departure_time,
                         third_center_loading_send_planned_arrival_time,
                         third_center_loading_send_actual_departure_time,
                         third_center_loading_send_actual_arrival_time,
                         third_center_loading_send_next_network_code,
                         third_center_loading_send_next_network_type,
                         fourth_center_network_code,
                         fourth_center_unloading_early_time,
                         fourth_center_unloading_early_weight,
                         fourth_center_arrival_early_time,
                         fourth_center_arrival_early_weight,
                         fourth_center_unloading_arrival_shipment_no,
                         fourth_center_unloading_arrival_planned_departure_time,
                         fourth_center_unloading_arrival_planned_arrival_time,
                         fourth_center_unloading_arrival_actual_departure_time,
                         fourth_center_unloading_arrival_actual_arrival_time,
                         fourth_center_loading_later_time,
                         fourth_center_loading_later_weight,
                         fourth_center_send_later_time,
                         fourth_center_send_later_weight,
                         fourth_center_loading_send_shipment_no,
                         fourth_center_loading_send_planned_departure_time,
                         fourth_center_loading_send_planned_arrival_time,
                         fourth_center_loading_send_actual_departure_time,
                         fourth_center_loading_send_actual_arrival_time,
                         fourth_center_loading_send_next_network_code,
                         fourth_center_loading_send_next_network_type,
                         end_center_network_code,
                         end_center_unloading_early_time,
                         end_center_unloading_early_weight,
                         end_center_arrival_early_time,
                         end_center_arrival_early_weight,
                         end_center_unloading_arrival_shipment_no,
                         end_center_unloading_arrival_planned_departure_time,
                         end_center_unloading_arrival_planned_arrival_time,
                         end_center_unloading_arrival_actual_departure_time,
                         end_center_unloading_arrival_actual_arrival_time,
                         end_center_loading_later_time,
                         end_center_loading_later_weight,
                         end_center_send_later_time,
                         end_center_send_later_weight,
                         end_center_loading_send_shipment_no,
                         end_center_loading_send_planned_departure_time,
                         end_center_loading_send_planned_arrival_time,
                         end_center_loading_send_actual_departure_time,
                         end_center_loading_send_actual_arrival_time,
                         end_center_loading_send_next_network_code,
                         end_center_loading_send_next_network_type,
                         end_nodal_network_code,
                         end_nodal_unloading_early_time,
                         end_nodal_unloading_early_weight,
                         end_nodal_arrival_early_time,
                         end_nodal_arrival_early_weight,
                         end_nodal_unloading_arrival_shipment_no,
                         end_nodal_unloading_arrival_planned_departure_time,
                         end_nodal_unloading_arrival_planned_arrival_time,
                         end_nodal_unloading_arrival_actual_departure_time,
                         end_nodal_unloading_arrival_actual_arrival_time,
                         end_nodal_loading_later_time,
                         end_nodal_loading_later_weight,
                         end_nodal_send_later_time,
                         end_nodal_send_later_weight,
                         end_nodal_loading_send_shipment_no,
                         end_nodal_loading_send_planned_departure_time,
                         end_nodal_loading_send_planned_arrival_time,
                         end_nodal_loading_send_actual_departure_time,
                         end_nodal_loading_send_actual_arrival_time,
                         end_nodal_loading_send_next_network_code,
                         end_nodal_loading_send_next_network_type,
                         end_network_network_code,
                         end_network_unloading_early_time,
                         end_network_arrival_early_time,
                         deliver_early_scantime,
                         deliver_later_scantime,
                         deliver_later_scansitecode,
                         deliver_later_weight,
                         deliver_later_user,
                         sign_later_scantime,
                         sign_early_scantime,
                         sign_early_scansitecode,
                         sign_early_weight,
                         aging_sign_scantime,
                         aging_sign_scansitecode,
                         aging_sign_weight,
                         aging_sign_scantype,
                         actual_sign_scantime,
                         actual_sign_scansitecode,
                         actual_sign_weight,
                         actual_sign_scantype,
                         waybill_status_code,
                         goods_type_id,
                         goods_type_code,
                         goods_type_name,
                         goods_name,
                         dispatch_network_code,
                         first_code,
                         second_code,
                         third_code,
                         is_sign,
                         sign_time,
                         is_abnormal,
                         waybill_source_code,
                         waybill_source_name,
                         is_void,
                         is_refund,
                         pick_network_code,
                         pick_network_name,
                         input_time,
                         input_network_code,
                         settlement_weight,
                         order_source_code,
                         is_delete,
                         package_collect_weight,
                         package_receipt_weight,
                         waybill_weight,
                         center_name,
                         center_code,
                         ordersource_code,
                         ordersource_name,
                         '{{ execution_date | cst_ds }}' as dt
                  from jms_dwd.dwd_s03_waybill_trace_scan_dt
                  where dt = '{{ execution_date | cst_ds }}'
                    and waybill_end_scantype not in ('sign', 'outStore')
                  union all
                  select waybill_no,
                         waybill_first_scantime,
                         waybill_first_scantype,
                         waybill_end_scantime,
                         waybill_end_scantype,
                         waybill_all_operation_times,
                         center_all_operation_times,
                         nodal_all_operation_times,
                         network_all_count,
                         center_all_count,
                         nodal_all_count,
                         actual_taking_scantime,
                         actual_taking_scansitecode,
                         actual_taking_weight,
                         actual_taking_scantype,
                         taking_later_scantime,
                         taking_early_scantime,
                         taking_early_scansitecode,
                         taking_early_weight,
                         warehousing_later_scantime,
                         warehousing_early_scantime,
                         warehousing_early_scansitecode,
                         warehousing_early_weight,
                         bagging_early_scantime,
                         bagging_early_scansitecode,
                         bagging_early_package_code,
                         first_network_network_code,
                         first_network_loading_later_time,
                         first_network_loading_later_weight,
                         first_network_send_later_time,
                         first_network_send_later_weight,
                         first_network_loading_send_shipment_no,
                         first_network_loading_send_planned_departure_time,
                         first_network_loading_send_planned_arrival_time,
                         first_network_loading_send_actual_departure_time,
                         first_network_loading_send_actual_arrival_time,
                         first_network_loading_send_next_network_code,
                         first_network_loading_send_next_network_type,
                         first_nodal_network_code,
                         first_nodal_unloading_early_time,
                         first_nodal_unloading_early_weight,
                         first_nodal_arrival_early_time,
                         first_nodal_arrival_early_weight,
                         first_nodal_unloading_arrival_shipment_no,
                         first_nodal_unloading_arrival_planned_departure_time,
                         first_nodal_unloading_arrival_planned_arrival_time,
                         first_nodal_unloading_arrival_actual_departure_time,
                         first_nodal_unloading_arrival_actual_arrival_time,
                         first_nodal_loading_later_time,
                         first_nodal_loading_later_weight,
                         first_nodal_send_later_time,
                         first_nodal_send_later_weight,
                         first_nodal_loading_send_shipment_no,
                         first_nodal_loading_send_planned_departure_time,
                         first_nodal_loading_send_planned_arrival_time,
                         first_nodal_loading_send_actual_departure_time,
                         first_nodal_loading_send_actual_arrival_time,
                         first_nodal_loading_send_next_network_code,
                         first_nodal_loading_send_next_network_type,
                         first_center_network_code,
                         first_center_unloading_early_time,
                         first_center_unloading_early_weight,
                         first_center_arrival_early_time,
                         first_center_arrival_early_weight,
                         first_center_unloading_arrival_shipment_no,
                         first_center_unloading_arrival_planned_departure_time,
                         first_center_unloading_arrival_planned_arrival_time,
                         first_center_unloading_arrival_actual_departure_time,
                         first_center_unloading_arrival_actual_arrival_time,
                         first_center_loading_later_time,
                         first_center_loading_later_weight,
                         first_center_send_later_time,
                         first_center_send_later_weight,
                         first_center_loading_send_shipment_no,
                         first_center_loading_send_planned_departure_time,
                         first_center_loading_send_planned_arrival_time,
                         first_center_loading_send_actual_departure_time,
                         first_center_loading_send_actual_arrival_time,
                         first_center_loading_send_next_network_code,
                         first_center_loading_send_next_network_type,
                         second_center_network_code,
                         second_center_unloading_early_time,
                         second_center_unloading_early_weight,
                         second_center_arrival_early_time,
                         second_center_arrival_early_weight,
                         second_center_unloading_arrival_shipment_no,
                         second_center_unloading_arrival_planned_departure_time,
                         second_center_unloading_arrival_planned_arrival_time,
                         second_center_unloading_arrival_actual_departure_time,
                         second_center_unloading_arrival_actual_arrival_time,
                         second_center_loading_later_time,
                         second_center_loading_later_weight,
                         second_center_send_later_time,
                         second_center_send_later_weight,
                         second_center_loading_send_shipment_no,
                         second_center_loading_send_planned_departure_time,
                         second_center_loading_send_planned_arrival_time,
                         second_center_loading_send_actual_departure_time,
                         second_center_loading_send_actual_arrival_time,
                         second_center_loading_send_next_network_code,
                         second_center_loading_send_next_network_type,
                         third_center_network_code,
                         third_center_unloading_early_time,
                         third_center_unloading_early_weight,
                         thirdcenter_arrival_early_time,
                         third_center_arrival_early_weight,
                         third_center_unloading_arrival_shipment_no,
                         third_center_unloading_arrival_planned_departure_time,
                         third_center_unloading_arrival_planned_arrival_time,
                         third_center_unloading_arrival_actual_departure_time,
                         third_center_unloading_arrival_actual_arrival_time,
                         third_center_loading_later_time,
                         third_center_loading_later_weight,
                         third_center_send_later_time,
                         third_center_send_later_weight,
                         third_center_loading_send_shipment_no,
                         third_center_loading_send_planned_departure_time,
                         third_center_loading_send_planned_arrival_time,
                         third_center_loading_send_actual_departure_time,
                         third_center_loading_send_actual_arrival_time,
                         third_center_loading_send_next_network_code,
                         third_center_loading_send_next_network_type,
                         fourth_center_network_code,
                         fourth_center_unloading_early_time,
                         fourth_center_unloading_early_weight,
                         fourth_center_arrival_early_time,
                         fourth_center_arrival_early_weight,
                         fourth_center_unloading_arrival_shipment_no,
                         fourth_center_unloading_arrival_planned_departure_time,
                         fourth_center_unloading_arrival_planned_arrival_time,
                         fourth_center_unloading_arrival_actual_departure_time,
                         fourth_center_unloading_arrival_actual_arrival_time,
                         fourth_center_loading_later_time,
                         fourth_center_loading_later_weight,
                         fourth_center_send_later_time,
                         fourth_center_send_later_weight,
                         fourth_center_loading_send_shipment_no,
                         fourth_center_loading_send_planned_departure_time,
                         fourth_center_loading_send_planned_arrival_time,
                         fourth_center_loading_send_actual_departure_time,
                         fourth_center_loading_send_actual_arrival_time,
                         fourth_center_loading_send_next_network_code,
                         fourth_center_loading_send_next_network_type,
                         end_center_network_code,
                         end_center_unloading_early_time,
                         end_center_unloading_early_weight,
                         end_center_arrival_early_time,
                         end_center_arrival_early_weight,
                         end_center_unloading_arrival_shipment_no,
                         end_center_unloading_arrival_planned_departure_time,
                         end_center_unloading_arrival_planned_arrival_time,
                         end_center_unloading_arrival_actual_departure_time,
                         end_center_unloading_arrival_actual_arrival_time,
                         end_center_loading_later_time,
                         end_center_loading_later_weight,
                         end_center_send_later_time,
                         end_center_send_later_weight,
                         end_center_loading_send_shipment_no,
                         end_center_loading_send_planned_departure_time,
                         end_center_loading_send_planned_arrival_time,
                         end_center_loading_send_actual_departure_time,
                         end_center_loading_send_actual_arrival_time,
                         end_center_loading_send_next_network_code,
                         end_center_loading_send_next_network_type,
                         end_nodal_network_code,
                         end_nodal_unloading_early_time,
                         end_nodal_unloading_early_weight,
                         end_nodal_arrival_early_time,
                         end_nodal_arrival_early_weight,
                         end_nodal_unloading_arrival_shipment_no,
                         end_nodal_unloading_arrival_planned_departure_time,
                         end_nodal_unloading_arrival_planned_arrival_time,
                         end_nodal_unloading_arrival_actual_departure_time,
                         end_nodal_unloading_arrival_actual_arrival_time,
                         end_nodal_loading_later_time,
                         end_nodal_loading_later_weight,
                         end_nodal_send_later_time,
                         end_nodal_send_later_weight,
                         end_nodal_loading_send_shipment_no,
                         end_nodal_loading_send_planned_departure_time,
                         end_nodal_loading_send_planned_arrival_time,
                         end_nodal_loading_send_actual_departure_time,
                         end_nodal_loading_send_actual_arrival_time,
                         end_nodal_loading_send_next_network_code,
                         end_nodal_loading_send_next_network_type,
                         end_network_network_code,
                         end_network_unloading_early_time,
                         end_network_arrival_early_time,
                         deliver_early_scantime,
                         deliver_later_scantime,
                         deliver_later_scansitecode,
                         deliver_later_weight,
                         deliver_later_user,
                         sign_later_scantime,
                         sign_early_scantime,
                         sign_early_scansitecode,
                         sign_early_weight,
                         aging_sign_scantime,
                         aging_sign_scansitecode,
                         aging_sign_weight,
                         aging_sign_scantype,
                         actual_sign_scantime,
                         actual_sign_scansitecode,
                         actual_sign_weight,
                         actual_sign_scantype,
                         waybill_status_code,
                         goods_type_id,
                         goods_type_code,
                         goods_type_name,
                         goods_name,
                         dispatch_network_code,
                         first_code,
                         second_code,
                         third_code,
                         is_sign,
                         sign_time,
                         is_abnormal,
                         waybill_source_code,
                         waybill_source_name,
                         is_void,
                         is_refund,
                         pick_network_code,
                         pick_network_name,
                         input_time,
                         input_network_code,
                         settlement_weight,
                         order_source_code,
                         is_delete,
                         package_collect_weight,
                         package_receipt_weight,
                         waybill_weight,
                         center_name,
                         center_code,
                         ordersource_code,
                         ordersource_name,
                         '{{ execution_date | cst_ds }}' as dt
                  from t_unsign t_unsign
                           left anti
                           join t_scan t_scan
                                on t_unsign.waybill_no = t_scan.waybill_no) a
     ) b
where b.rnk = 1
    distribute by pmod(hash(waybill_no), 50);
